package net.tooeye.easymes.services;

import android.app.NotificationManager;
import android.app.Service;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.os.Binder;
import android.os.IBinder;
import android.util.Log;

import redis.clients.jedis.Jedis;

/*
    消息拉取服务

 */
public class PushService extends Service {
    public  static final  String TAG= "PushService";
    public  static final  String SERVICE_URL = "";
    private ConnectivityManager mConn;
    private NotificationManager mNoti;
    private boolean mStarted;
    private static final  long KEEP_ALIVE_INTERVAL = 1000*60*6;
    private Jedis jedis;

    public PushService() {
    }

    @Override
    public void onCreate() {
        super.onCreate();
        try{
            jedis = new Jedis("192.168.2.116",6379);
        }catch (Exception e){

        }


    }

    // 服务启动
    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        return super.onStartCommand(intent, flags, startId);
    }

    //服务销毁
    @Override
    public void onDestroy() {
        stopSelf(); //自杀服务
        super.onDestroy();
    }

    @Override
    public IBinder onBind(Intent intent) {
        // TODO: Return the communication channel to the service.
      //  throw new UnsupportedOperationException("Not yet implemented");
      //  Jedis jedis = new Jedis("192.168.2.116",6379);
        return  new MyBinder();
    }

    class MyBinder extends Binder {

        public PushService getService(){
            return PushService.this;
        }
    }

}
